<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopUploadFileResource extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_upload_file_resource', function (Blueprint $table) {
            $table->id();
            $table->string('orderNo')->default('')->comment('订单号');
            $table->string('url')->default('')->comment('文件链接地址');
            $table->unsignedTinyInteger('position')->default(0)->comment('文件位置');
            $table->unsignedTinyInteger('type')->default(1)->comment('文件类型 1：img 2 cad 3 pdf ');
            $table->unsignedInteger('sort')->default(0)->comment('文件排序 越小越靠前');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除 0 否 1 是');
            $table->collation = 'utf8mb4_general_ci';
            $table->index(['orderNo'], 'idx_orderNo');
            $table->comment = '文件上传结果表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_upload_file_resource');
    }
}
